import { createRouter, createWebHistory, type Router } from 'vue-router'
import LoginView from '../views/LoginView.vue'
import Dashboard from '@/views/Dashboard.vue'
import HomePage from '@/views/HomePage.vue'



let routes = [
  {
    path: '/',
    name: 'home',
    component: HomePage,
    children: [
      {
        path: '/index',
        name: 'index',
        component: () => import('@/components/Index.vue'),
      },
      {
        path: '/article',
        name: 'article',
        component: () => import('@/components/Article.vue'),
      },
      {
        path: '/about',
        name: 'about',
        component: () => import('@/components/About.vue'),
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView,
  },
  {
    path: '/dashboard',
    name: 'dashboard',
    component: Dashboard,
    children: [
      {
        path: '/dashboard/article',
        name: 'articleManage',
        component: () => import('@/views/ArticleManage.vue'),
      },
    
    ]
  }
]

const router:Router = createRouter({
  history: createWebHistory(),
  routes: routes,
})

export {router,routes}  // export default则是把整个{}作为一个对象进行导出 其它地方只能把整个对象import
